﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class CountryCcyMaintan : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            GridView1.Visible = false;
            FormView1.Visible = false;
        }
    }
    private void insertmode() {
        FormView1.Visible = true;
        GridView1.Visible = false;
    }
    private void displaymode() {
        FormView1.Visible = false;
        GridView1.Visible = true;
        GridView1.DataBind();
    }

    protected void queryBtn_Click(object sender, EventArgs e)
    {
        displaymode();
    }
    protected void InsertBtn_Click(object sender, EventArgs e)
    {
        FormView1.ChangeMode(FormViewMode.Insert);
        insertmode();
    }
    protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
    {
    }
    protected void GridView1_RowUpdated(object sender, GridViewUpdatedEventArgs e)
    {
        displaymode();
    }
    protected void FormView1_ItemCommand(object sender, FormViewCommandEventArgs e)
    {
        displaymode();
    }
    protected void FormView1_ItemInserted(object sender, FormViewInsertedEventArgs e)
    {
        displaymode();
    }
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        Common.UI.ShowMessageBox(this.Page, "資料刪除完成");
    }
    protected void FormView1_DataBound(object sender, EventArgs e)
    {
        FormView fv = (FormView)sender;
        if (fv.DefaultMode == FormViewMode.Insert)
        {
            TextBox tb = (TextBox)fv.FindControl("ItemTypeTextBox");
            tb.Text = "CountryCcy";
        }
    }
}
